<template>
<!--专题页-->
  <div class="zhuanti">
    <div v-for="item in data" :key="item.id" class="box">
      <img class="pic" v-lazy="item.scene_pic_url" alt="" />
      <div class="title">{{ item.title }}</div>
      <div class="tip">{{ item.subtitle }}</div>
      <div class="price">{{ item.price_info | filtermoney }}起</div>
    </div>
    <van-pagination
      v-model="currentPage"
      :items-per-page="items_per_page"
      :page-count="totalPages"
      mode="simple"
      @change="changeFn"
    />
    <BackTop/>
  </div>
</template>
 
<script>
import { GetTopic } from "..//request/api";
import BackTop from '../components/BackTop.vue'
export default {
  data() {
    return {
      currentPage: 1,
      totalPages: "2",
      items_per_page: 10,
      data: [],
    }
  },
  components: {
    BackTop
  },
  methods: {
    changeFn() {
      this.getPage();
    },
    // 做页面数据请求
    getPage() {
      GetTopic({
        page: this.currentPage,
        size: this.items_per_page,
      }).then((res) => {
        if (res.errno == 0) {
          let { count, totalPages, pageSize, currentPage, data } = res.data;
          this.data = data;
          this.totalPages = totalPages;
          this.items_per_page = pageSize;
          this.currentPage = currentPage;
          // 返回顶部
          document.documentElement.scrollTop = 0;
        }
      });
    },
  },
  created() {
    this.getPage();
  }
};
</script>
 
<style lang="less" scoped>
.van-pagination__item {
  color: darkred;
}
.van-pagination__item--disabled {
  color: #333;
}
.van-pagination__page-desc {
  display: none;
}
.zhuanti {
  padding-bottom: 100px;
  .box {
    background-color: #fff;
    text-align: center;
    padding-bottom: 10px;
    margin-bottom: 20px;
    .pic {
      width: 100%;
    }
    .title {
      font-size: 18px;
      margin: 10px 0;
    }
    .tip {
      font-size: 16px;
      margin: 20px 0;
      color: rgb(31, 31, 31);
      overflow: hidden;
      text-overflow: ellipsis;
      /* 弹性伸缩盒子模型显示 */
      display: -webkit-box;
      /* 限制在一个块元素显示的文本的行数 */
      -webkit-line-clamp: 1;
      /* 设置或检索伸缩盒对象的子元素的排列方式 */
      -webkit-box-orient: vertical;
    }
    .price {
      color: rgb(155, 0, 0);
      margin-bottom: 10px;
    }
  }
}
/deep/.van-pagination__page-desc {
  display: none;
}
/deep/.van-pagination__item  {
  color: darkred;
}
</style>